# Echo client program
import socket, threading


class ClientReader(threading.Thread):
	def __init__(self,server_sock):
		self.server_sock = server_sock
		threading.Thread.__init__ ( self )
	def run(self):
		while 1:
			self.chunk = self.server_sock.recv(1024)
			if(len(self.chunk)>0):
				if(self.chunk==b'quit'):
					break
				print(self.chunk.decode())

HOST = '10.238.242.244'    # The remote host
PORT = 15000              # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
data = s.recv(1024)
print(data.decode('utf-8'))
ClientReader(s).start()
data=input()
while 1:
	s.send(bytes(data,'utf-8'))	
	if(data=='quit'):
		s.send(bytes('quit','utf-8'))
		break
	data=input()
# data=input('Enter something: ')
# while (data!='quit'):
	# s.send(bytes(data,'ascii'))
	# data=input('Enter something: ')
#data = s.recv(1024)
# s.close()
#print('Received', repr(data))